package com.bailiban.controller;

import com.bailiban.entity.Syslog;
import com.bailiban.service.SyslogService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author zhulang
 * @Classname SysLogController
 * @Description SysLogController
 */
@Controller
@RequestMapping("sysLog")
public class SysLogController {
    @Autowired
    private SyslogService syslogService;

    @GetMapping("findAll")
    public ModelAndView findAll(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "5") Integer size) {
        PageInfo<Syslog> pageInfo = syslogService.findAll(page, size);
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("syslog-list");
        modelAndView.addObject("sysLogsInfo", pageInfo);
        return modelAndView;
    }
}
